<%@page import="java.util.Collections"%>
<%@page import="model.Domain"%>
<%@page import="javax.cache.CacheException"%>
<%@page import="java.util.ArrayList"%>
<%@page import="javax.cache.CacheManager"%>
<%@page import="javax.cache.Cache"%>
<%@page import="java.util.Date"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@page import="java.util.List"%>
<%
	String title = "Rss - Synthesis, analysis, reviews site";
	String description = "Rss - Evaluation site - collection and analysis of data from domains. Comparative characteristic and tracking of important statistic parameters";
	Cache cache=null;
	try {
	    cache = CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());
	} catch (CacheException e) {
	   e.printStackTrace();
	   
	}
	ArrayList<Domain> listDomain = null;
	if(cache.containsKey("lastupdates"))
	{
		listDomain = (ArrayList<Domain>) cache.get("lastupdates");
	}
	%>
<?xml version="1.0" encoding="UTF-8"?>
  <rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">
	
    <channel>
    
    <title><![CDATA[ <%=title %>]]></title>
    <link>http://evaluationsites.appspot.com/</link>
    <description><![CDATA[<%=description %>]]></description>
    <dc:language>en-ca</dc:language>
    <dc:creator>google app engine</dc:creator>

    <dc:rights>Copyright 2011</dc:rights>
    <admin:generatorAgent rdf:resource="http://evaluationsites.appspot.com/" />
    	<%
		if(listDomain != null)
		{
		%>
			<%
			for(int i=0;i<listDomain.size();i++)
			{
			%>
		       <item>
		          <title><![CDATA[ <%=(listDomain.get(i).getTitle() != null&&!listDomain.get(i).getTitle().getValue().equals("null"))?listDomain.get(i).getTitle().getValue():listDomain.get(i).getName() %> ]]></title>
		          <link>http://evaluationsites.appspot.com/site/<%=listDomain.get(i).getName() %></link>
		          <guid>http://evaluationsites.appspot.com/site/<%=listDomain.get(i).getName() %></guid>
		
		          <description><![CDATA[ 
		          <%=(listDomain.get(i).getDescription() != null&&!listDomain.get(i).getDescription().getValue().equals("null"))?listDomain.get(i).getDescription().getValue():listDomain.get(i).getName() %>
		          ]]></description>
		      	  <pubDate>
		      	  	<%=new Date(Long.parseLong(listDomain.get(i).getLastUpdate().getValue())).toGMTString()%>
		      	  </pubDate>
		       </item>
       <%
			}
    	}
       %>
    </channel>
</rss>  